package com.uwo.house.beans;

/**
 * 分页
 * 
 * @author Young
 *
 */
public class Pagination {
	public int page = 1; // 当前页
	public int pageSize = 5; // 每页的数量
	public int offset; // 偏移量
	public int limit; // 查询数量

	public int getPage() {
		return page;
	}

	public void setPage(Integer page) {
		if(page == null) {
			this.page = 0;
		} else {
			this.page = page;
		}
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		if(pageSize == null) {
			this.pageSize = 0;
		} else {
			this.pageSize = pageSize;
		}
	}

	public void setOffset() {
		if(page > 0 && pageSize > 0) {
			this.offset = (page - 1) * pageSize;
		} else {
			this.offset = -1;
		}
	}

	public void setLimit() {
		if(pageSize > 0) {
			this.limit = pageSize;
		} else {
			this.limit = -1;
		}
	}

}
